
var schedule = require("node-schedule");
var moment = require('moment');
module.exports = function() {
    var Task = null;
    var start = function(timePlan) {
        Task = schedule.scheduleJob(timePlan, function() {
            console.log(moment().format("YYYY-MM-DD HH:mm:ss"));
            Main();
        });
    };
    var stop = function() {
        Task.cancel();
        console.log("同步任务计划-关闭");
    };

    var Main = async function() {
        console.log("------任务计划-开始------");

        console.log("------任务计划-结束------");
    };

    return {
        start: start,
        stop: stop
    }
};
